// 版权归 Epic Games, Inc. 所有。保留所有权利。

#pragma once

#include "CommonListView.h"

#include "LyraListView.generated.h"

#define UE_API LYRAGAME_API

class UUserWidget;
class ULocalPlayer;
class ULyraWidgetFactory;

UCLASS(MinimalAPI, meta = (DisableNativeTick))
class ULyraListView : public UCommonListView
{
	GENERATED_BODY()

public:
	/**
	 * 构造函数
	 * @param ObjectInitializer 对象初始化器
	 */
	UE_API ULyraListView(const FObjectInitializer& ObjectInitializer = FObjectInitializer::Get());

#if WITH_EDITOR
	/**
	 * 验证编译默认值
	 * @param InCompileLog 编译日志接口
	 */
	UE_API virtual void ValidateCompiledDefaults(IWidgetCompilerLog& InCompileLog) const override;
#endif

protected:
	/**
	 * 内部生成条目控件
	 * @param Item 数据项
	 * @param DesiredEntryClass 期望的条目类
	 * @param OwnerTable 所属表格视图
	 * @return 生成的用户控件引用
	 */
	UE_API virtual UUserWidget& OnGenerateEntryWidgetInternal(UObject* Item, TSubclassOf<UUserWidget> DesiredEntryClass, const TSharedRef<STableViewBase>& OwnerTable) override;
	//virtual bool OnIsSelectableOrNavigableInternal(UObject* SelectedItem) override;

protected:
	UPROPERTY(EditAnywhere, Instanced, Category="Entry Creation")
	TArray<TObjectPtr<ULyraWidgetFactory>> FactoryRules; // 控件工厂规则数组
};

#undef UE_API